package com.czxy.dao;

import com.czxy.domain.OrderItem;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface OrderItemMapper extends Mapper<OrderItem> {


    public void addItems(@Param("items") List<OrderItem> items);



    // 根据订单id 查询 所有的订单项
    @Select(" select * from orderitem where oid = #{oid}")
    @Results({
            @Result(property = "pid",column = "pid"),
            @Result(property = "product",
                    one = @One(select = "com.czxy.dao.ProductMapper.selectByPrimaryKey"),
                    column = "pid")
    })

    public List<OrderItem>  findOrderItemsByOid(@Param("oid") String oid);
}
